import {fromJS} from 'immutable';//让数据变成immutable对象，管理初始化不让修改的数据  要使用state.set等方法，他不改变原始内容返回新的对象
import * as constants from './constants';
const  defaultState=fromJS({
       images:[],
    showScroll:false,
    news:[],
    teachers:[],
    students:[],
    baseBar:[],

});
export  default (state=defaultState,action)=>{
    switch (action.type) {
        case constants.TOGGLE_SCROLL_TOP:
            return  state.set('showScroll',action.show);
        case constants.CHANGE_IMG:
            return state.set('images',action.images);
        case constants.CHANGE_HOME:
            return   state.merge({
                news:action.News,
                teachers:action.Teacher,
                students:action.Student,
                baseBar:action.baseBar
            });
        default:
            return state;
    }
}